package com.yidu.BusinessParament.mapper;

import com.yidu.BusinessParament.entity.ExchangeRate;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;
/**
 * @author 苏彬
 * @date 2022/12/9 13:44
 **/
@Mapper
public interface ExchangeRateMapper {
    @Select("select * from exchangeRate where 1=1 ${term} ORDER BY exchangeRateId limit #{page},#{row}")
    List<ExchangeRate> selectExchangeRate(Map map);

    @Select("select count(*) from exchangeRate where 1=1 ${term}")
    int selectExchangeRateCount(Map map);

    @Delete("delete from exchangeRate where exchangeRateId=#{exchangeRateId}")
    void deleteExchangeRate(String exchangeRateId);

    @Insert("insert into exchangeRate values(#{exchangeRateId},#{exchangeRateName},#{exchangeType},#{stampDuty},#{transferFee},#{collectionFee},#{handlingFee},#{Remark})")
    int addExchangeRate(ExchangeRate rate);


    @Update("update exchangeRate set exchangeRateName=#{exchangeRateName},exchangeType=#{exchangeType},stampDuty=#{stampDuty},transferFee=#{transferFee},collectionFee=#{collectionFee},handlingFee=#{handlingFee},Remark=#{Remark} where exchangeRateId=#{exchangeRateId}")
    int updateExchangeRate(ExchangeRate rate);

    @Select("select exchangeRateId from exchangeRate ORDER BY exchangeRateId DESC LIMIT 0,1")
    String MaxId();
}
